package com.tank;

import com.tank.net.Client;

import java.util.Objects;

/**
 * @author CaoBaoYin
 * @since 21/8/13 10:32
 */
public class Main {

    public static void main(String[] args) {
        TankFrame tf = TankFrame.INSTANCE;
        tf.setVisible(true);

        Tank mainTank = tf.getMainTank();
        tf.tankMap.put(mainTank.getId(), mainTank);

        /*int initTankCount = Integer.parseInt(Objects.requireNonNull(PropertyManager.get("initTankCount")).toString());
        for (int i = 0; i < initTankCount; i++) {
            tf.tankList.add(new Tank(50+i*50, 200, DirectionEnum.DOWN, Group.BAD, tf));
        }*/

        new Thread(()->new Audio("audio/war1.wav").loop()).start();

        new Thread(()->{
            while (true) {
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                tf.repaint();
            }
        }).start();

        Client.INSTANCE.connect();
    }

}
